﻿Imports System.Windows.Forms
Imports ControleMatricula.Negocio

Public Class MDIControleMatricula
    Dim db As New DataClassesDataContext()

    Private Sub SubMnuCadastroAluno_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SubMnuCadastroAluno.Click

        Dim SubMnuCadastroAluno As FrmAlunoCompleto
        SubMnuCadastroAluno = New FrmAlunoCompleto
        SubMnuCadastroAluno.Owner = Me
        SubMnuCadastroAluno.MdiParent = Me
        SubMnuCadastroAluno.Show()

    End Sub

    Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs)
        Dim OpenFileDialog As New OpenFileDialog
        OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
        If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = OpenFileDialog.FileName
            ' TODO: Add code here to open the file.
        End If
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

        If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = SaveFileDialog.FileName
            ' TODO: Add code here to save the current contents of the form to a file.
        End If
    End Sub


    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.Close()
    End Sub

    Private Sub SubMnuPagamento_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SubMnuPagamento.Click

        Dim SubMnuPagamento As FrmPagamento
        SubMnuPagamento = New FrmPagamento
        SubMnuPagamento.Owner = Me
        SubMnuPagamento.MdiParent = Me
        SubMnuPagamento.Show()

    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
    End Sub

    Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SubMnuEfeuarLogin.Click

        For Each oForm In Me.MdiChildren
            If Not IsNothing(oForm) Then
                oForm.Close()
            End If
        Next

        Me.Opacity = 0.8

        System.Diagnostics.Debug.WriteLine(AnimateWindow(Me.Handle.ToInt32, 2000, &H5S Or &H80000))
        Me.WindowState = FormWindowState.Maximized

        System.Threading.Thread.CurrentThread.CurrentCulture = _
            New System.Globalization.CultureInfo("pt-BR")

        Dim login As New FrmLogin
        login.ShowDialog()

    End Sub

    Private Sub SubMnuSairSistema_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SubMnuSairSistema.Click
        If MsgBox("Você tem certeza que deseja sair do sistema?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo, "Gestor.Net") = MsgBoxResult.Yes Then
            End
        End If
    End Sub

    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub

    Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub

    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Close all child forms of the parent.
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Close()
        Next
    End Sub

    Private m_ChildFormNumber As Integer

    Private Sub MenuStrip_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip.ItemClicked

    End Sub

    Private Sub SubMnuEspecifica_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubMnuEspecifica.Click

        Dim SubMnuEspecifica As FrmEspecifica
        SubMnuEspecifica = New FrmEspecifica
        SubMnuEspecifica.Owner = Me
        SubMnuEspecifica.MdiParent = Me
        SubMnuEspecifica.Show()

    End Sub

    Private Sub SubMnuFuncionario_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubMnuFuncionario.Click

        Dim SubMnuFuncionario As FrmFuncionario
        SubMnuFuncionario = New FrmFuncionario
        SubMnuFuncionario.Owner = Me
        SubMnuFuncionario.MdiParent = Me
        SubMnuFuncionario.Show()

    End Sub

    Private Sub SubMnuListaAluno_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubMnuListaAluno.Click

        Dim SubMnuListaAluno As FrmListaAluno
        SubMnuListaAluno = New FrmListaAluno
        SubMnuListaAluno.Owner = Me
        SubMnuListaAluno.MdiParent = Me
        SubMnuListaAluno.Show()

    End Sub

    Private Sub SubMnuRelGeral_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubMnuRelGeral.Click

        Dim SubMnuRelMatriculaDiaria As FrmRelGeral
        SubMnuRelMatriculaDiaria = New FrmRelGeral
        SubMnuRelMatriculaDiaria.Owner = Me
        SubMnuRelMatriculaDiaria.MdiParent = Me
        SubMnuRelMatriculaDiaria.Show()

    End Sub
    Private Declare Function AnimateWindow Lib "user32" (ByVal hWnd As Integer, ByVal dwTime As Integer, ByVal dwFlags As Integer) As Integer

    Private Sub MDIGestorNET_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

        If MsgBox("Você tem certeza que deseja sair do sistema?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo, "Gestor.Net") = MsgBoxResult.No Then
            e.Cancel = True
        Else
            End
        End If

    End Sub
    Private Sub MDIControleMatricula_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Me.Text = GlobalVersaoMDI

        Me.Opacity = 0.8

        System.Diagnostics.Debug.WriteLine(AnimateWindow(Me.Handle.ToInt32, 2000, &H5S Or &H80000))
        Me.WindowState = FormWindowState.Maximized

        System.Threading.Thread.CurrentThread.CurrentCulture = _
            New System.Globalization.CultureInfo("pt-BR")

        Dim login As New FrmLogin
        login.ShowDialog()

        Dim UsuarioLogado As New List(Of SPFuncionarioConsultarResult)
        UsuarioLogado = db.SPFuncionarioConsultar(GlobalLogin, "").ToList()

        Me.StripLabel.Text = "Usuário Logado: " & UsuarioLogado(0).Nome & "   " & System.DateTime.Today.ToLongDateString()

    End Sub

    Private Sub SubMnuRelMatriculaDiaria_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubMnuRelMatriculaDiaria.Click

        Dim SubMnuRelMatriculaDiaria As FrmRelMatriculaDiaria
        SubMnuRelMatriculaDiaria = New FrmRelMatriculaDiaria
        SubMnuRelMatriculaDiaria.Owner = Me
        SubMnuRelMatriculaDiaria.MdiParent = Me
        SubMnuRelMatriculaDiaria.Show()

    End Sub

    Private Sub MnuRelatorio_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuRelatorio.Click

    End Sub
End Class
